package com.edu.chat.web.covert;

import com.edu.buservice.util.model.TenantUtil;
import com.edu.chat.facade.model.dto.RecallResDTO;
import com.edu.chat.facade.model.enums.SourceEnum;
import com.edu.chat.web.dto.DocumentDTO;
import com.edu.chat.web.dto.SearchDocDTO;
import com.edu.chat.web.model.DocEntity;

/**
 * @program: KQAIA
 * @description:
 * @author: 无恙
 * @create: 2025-04-06 11:55
 **/


public class DocumentCovert {

	public static DocEntity covert(DocumentDTO documentDTO) {
		DocEntity docEntity = new DocEntity();
		docEntity.setDocumentId(documentDTO.getId());
		docEntity.setLibraryId(documentDTO.getLibraryId());
		docEntity.setText(documentDTO.getContent());
		docEntity.setTenantId(TenantUtil.getTenantId());
		return docEntity;
	}

	public static RecallResDTO covertToRecallRes(SearchDocDTO documentDTO) {
		RecallResDTO recallResDTO = new RecallResDTO();
		recallResDTO.setSourceId(String.valueOf(documentDTO.getId()));
		recallResDTO.setContent(documentDTO.getText());
		recallResDTO.setSource(SourceEnum.DOC.getCode());
		recallResDTO.setTenantId(TenantUtil.getTenantId());
		recallResDTO.setConfidence(documentDTO.getScore());
		return recallResDTO;
	}
}
